import 'package:flutter/material.dart';
import 'package:whale/helper/utils/httputils/http_man.dart';
import 'dart:ui' as ui;
import 'package:whale/helper/utils/wxMan.dart';

import '../../../../helper/utils/util.dart';
import '../../../home/main/widgets/hello.dart';
import 'index.dart';

class ShareDemoPage extends GetView<ShareDemoController> {
  const ShareDemoPage({Key? key}) : super(key: key);

  // 主视图
  Widget _buildView() {
    return ListView(
      children: [
        Textcell(
            text: '分享文字',
            onTap: () {
              Wxman.shareText(
                  // title: '平时考核系统',
                  // des: '公务员线上绩效考核',
                  content:
                      '完善考核体系，增强考核科学性。建立完善“1+5”指标体系，以政治标准为首，设置各项精细化指标。突出考核重点，将区委、区政府重大工作或临时性、突发性任务安排补充纳入考核内容，让考核更加合实情、显实效。');
            }),
        Textcell(
            text: '分享图片',
            onTap: () async {
              final res = await HttpMan.instance.getImage(
                  'https://pics6.baidu.com/feed/79f0f736afc379316c3ac5e1e3e2a24b42a9115f.jpeg@f_auto?token=425de036d1f58d9b87a1981f3f0f887e');

              Wxman.shareImg(
                title: '平时考核系统',
                des: '公务员线上绩效考核',
                image: res!,
              );
            }),
        Textcell(
            text: '分享文件',
            onTap: () {
              Wxman.shareFile(
                  title: '平时考核系统',
                  des: '公务员线上绩效考核',
                  url:
                      'https://gitee.com/ichengchengcui/top_check_version/raw/master/%E6%B5%8B%E8%AF%95111111.docx');
            }),
        Textcell(
            text: '分享链接',
            onTap: () {
              Wxman.shareWeb(
                  title: '平时考核系统',
                  des: '公务员线上绩效考核',
                  url: 'https://jixiao.inspirestar.cn/assessment-app/#/login');
            }),
      ],
    );
  }

  @override
  Widget build(BuildContext context) {
    return GetBuilder<ShareDemoController>(
      builder: (_) {
        return Scaffold(
          appBar: AppBar(title: const Text("share_demo")),
          body: SafeArea(
            child: _buildView(),
          ),
        );
      },
    );
  }
}
